Better diagnosis of the failure when Xend crashes. Thanks to Hollis Blanchard
authoremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Wed, 9 Aug 2006 08:52:43 +0000 (09:52 +0100)
committeremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Wed, 9 Aug 2006 08:52:43 +0000 (09:52 +0100)
for diagnosis.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/python/xen/util/xmlrpclib2.py
tools/python/xen/xm/create.py
tools/python/xen/xm/main.py

index c4976abc2e15aa10ac1967dd40f9db09dd819e17..5231881d22d3ffc3b7bd0aab45307ef50f6e4ac3 100644 (file)
@@ -138,6 +138,11 @@ class TCPXMLRPCServer(SocketServer.ThreadingMixIn, SimpleXMLRPCServer):
 
     def _marshaled_dispatch(self, data, dispatch_method = None):
         params, method = xmlrpclib.loads(data)
+        if False:
+            # Enable this block of code to exit immediately without sending
+            # a response.  This allows you to test client-side crash handling.
+            import sys
+            sys.exit(1)
         try:
             if dispatch_method is not None:
                 response = dispatch_method(method, params)
index d993fc32ab97188a7079a2fe760ba04a8d3a2585..545d12759512d5c8b36ebb4dc725ff2582af8839 100644 (file)
@@ -972,7 +972,7 @@ def make_domain(opts, config):
         import signal
         if vncpid:
             os.kill(vncpid, signal.SIGKILL)
-        raise ex
+        raise
 
     dom = sxp.child_value(dominfo, 'name')
 
index 83021a49ade507ae2d859df018d3a54a8761b1fa..799833a1ca4aa7947baf5d92d17c63a1a5f99c40 100644 (file)
@@ -1257,6 +1257,16 @@ def main(argv=sys.argv):
             else:
                 print  >>sys.stderr, "Error: %s" % ex.faultString
             sys.exit(1)
+        except xmlrpclib.ProtocolError, ex:
+            if ex.errcode == -1:
+                print  >>sys.stderr, (
+                    "Xend has probably crashed!  Invalid or missing HTTP "
+                    "status code.")
+            else:
+                print  >>sys.stderr, (
+                    "Xend has probably crashed!  ProtocolError(%d, %s)." %
+                    (ex.errcode, ex.errmsg))
+            sys.exit(1)
         except (ValueError, OverflowError):
             err("Invalid argument.")
             usage(argv[1])